<!--
 * @description 组件
 * @author: 陈陈
 * @date: 2025/05/09
 * @phone: 18560000860
 * @email: 18560000860@qq.com
 * @company: 济南晨霜信息技术有限公司 /
 * @business: 承接前后端项目的开发
-->
<template>
	<view
		class="pure-list"
		:class="_classes"
		:style="_styles"
	>
		<!-- 空状态 -->
		<view
			class="pure-list__empty"
			v-if="status === 'empty'"
		>
			<slot name="empty">
				<pure-empty v-bind="emptyOpts">
					<slot name="empty-default"></slot>
				</pure-empty>
			</slot>
		</view>

		<!-- 列表 -->
		<view
			class="pure-list__body"
			v-if="status !== 'empty'"
		>
			<slot></slot>
		</view>

		<!-- 加载更多 -->
		<view
			class="pure-list__footer"
			v-if="status !== 'empty'"
		>
			<slot name="loadmore">
				<pure-loadmore
					v-bind="loadmoreOpts"
					:status="status"
				></pure-loadmore>
			</slot>
		</view>
	</view>
</template>

<script>
	import commonComponentOptions from "../../config/options";
	export default {
		options: commonComponentOptions
	};
</script>

<script setup>
	import { computed } from "vue";
	import props from "./props";

	// -------------------------------------------------------------------------------- Props
	const _props = defineProps(props);

	// -------------------------------------------------------------------------------- Emits
	const _emits = defineEmits([]);

	// -------------------------------------------------------------------------------- Classes
	const _classes = computed(() => {
		const array = [];
		return array;
	});

	// -------------------------------------------------------------------------------- Styles
	const _styles = computed(() => {
		const array = [];

		// 列数
		if (_props.cols) array.push(`--pure-list-columns: ${_props.cols};`);

		// 间距
		if (_props.gap) array.push(`--pure-list-gap: ${_props.gap};`);

		return array;
	});
</script>

<style scoped lang="scss">
	@import "./style.scss";
</style>
